<!DOCTYPE html>
<html lang="zh-CN" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>核心对象和服务注册表 | Homalos</title>
    <meta name="description" content="基于 Python 的量化交易系统">
    <meta name="generator" content="VitePress v1.6.3">
    <link rel="preload stylesheet" href="/assets/style.RmNjDeKb.css" as="style">
    <link rel="preload stylesheet" href="/vp-icons.css" as="style">
    <script type="module" src="/assets/chunks/metadata.28daeedd.js"></script>
    <script type="module" src="/assets/app.BvKZi2Jp.js"></script>
    <link rel="preload" href="/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
    <link rel="modulepreload" href="/assets/chunks/framework.CXkkaYWf.js">
    <link rel="modulepreload" href="/assets/chunks/theme.C_3djJbO.js">
    <link rel="modulepreload" href="/assets/chunks/katex.ChWnQ-fc.js">
    <link rel="modulepreload" href="/assets/chunks/dagre-FFZHY6LT.v5YVXi2p.js">
    <link rel="modulepreload" href="/assets/chunks/c4Diagram-6F6E4RAY.nCOphmw6.js">
    <link rel="modulepreload" href="/assets/chunks/flowDiagram-PKI6S5ZS.CNud1oVM.js">
    <link rel="modulepreload" href="/assets/chunks/erDiagram-R3QVA2FD.DXgbj8um.js">
    <link rel="modulepreload" href="/assets/chunks/gitGraphDiagram-GW3U2K7C.BIFeTK-V.js">
    <link rel="modulepreload" href="/assets/chunks/ganttDiagram-EK5VF46D.DQ3Wppe5.js">
    <link rel="modulepreload" href="/assets/chunks/infoDiagram-XT3IWWJI.BaVwhgm7.js">
    <link rel="modulepreload" href="/assets/chunks/pieDiagram-NIOCPIFQ.DSbeskqj.js">
    <link rel="modulepreload" href="/assets/chunks/quadrantDiagram-2OG54O6I.DF4IDJMG.js">
    <link rel="modulepreload" href="/assets/chunks/xychartDiagram-H2YORKM3.CdWfFttn.js">
    <link rel="modulepreload" href="/assets/chunks/requirementDiagram-SO3GGRV7.DMU_G9xQ.js">
    <link rel="modulepreload" href="/assets/chunks/sequenceDiagram-ZIKVLSP4.kn4OakjH.js">
    <link rel="modulepreload" href="/assets/chunks/classDiagram-BGRH5UQR.DgQjJs6U.js">
    <link rel="modulepreload" href="/assets/chunks/classDiagram-v2-O24JOBDK.DgQjJs6U.js">
    <link rel="modulepreload" href="/assets/chunks/stateDiagram-XX37X6EN.CRy2e-oJ.js">
    <link rel="modulepreload" href="/assets/chunks/stateDiagram-v2-GD6S3NHB.BvRhId1O.js">
    <link rel="modulepreload" href="/assets/chunks/journeyDiagram-EWQZEKCU.BmQuVtJT.js">
    <link rel="modulepreload" href="/assets/chunks/timeline-definition-RI47OAVP.BxnQlAvf.js">
    <link rel="modulepreload" href="/assets/chunks/mindmap-definition-CZNETY7S.COCrfbvy.js">
    <link rel="modulepreload" href="/assets/chunks/kanban-definition-ILFWEQ3N.ChbXTd5M.js">
    <link rel="modulepreload" href="/assets/chunks/sankeyDiagram-4UZDY2LN.CpcNCvzD.js">
    <link rel="modulepreload" href="/assets/chunks/diagram-5UYTHUR4.J7RHmGCi.js">
    <link rel="modulepreload" href="/assets/chunks/diagram-ZTM2IBQH.BuJ-LU2f.js">
    <link rel="modulepreload" href="/assets/chunks/blockDiagram-PHRCVELO.DewF8s8X.js">
    <link rel="modulepreload" href="/assets/chunks/architectureDiagram-NQ2NVSRB.wzQlUmK0.js">
    <link rel="modulepreload" href="/assets/chunks/diagram-3EMPZRKU.1yGJgsvk.js">
    <link rel="modulepreload" href="/assets/chunks/virtual_mermaid-config.DDnGl6nM.js">
    <link rel="modulepreload" href="/assets/core_objects_and_service_registry.md.U1SkGKOU.lean.js">
    <link rel="icon" type="image/png" sizes="32x32" href="/assets/newnewlogo.png">
    <link rel="icon" type="image/png" sizes="16x16" href="/assets/newnewlogo.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/assets/newnewlogo.png">
    <link rel="mask-icon" href="/assets/newnewlogo.png" color="#5bbad5">
    <meta name="theme-color" content="#5f67ee">
    <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
    <script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
  </head>
  <body>
    <div id="app"><div class="Layout" data-v-5d98c3a5><!--[--><!--[--><!--]--><!--]--><!--[--><span tabindex="-1" data-v-0b0ada53></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0b0ada53>Skip to content</a><!--]--><!----><header class="VPNav" data-v-5d98c3a5 data-v-ae24b3ad><div class="VPNavBar" data-v-ae24b3ad data-v-6aa21345><div class="wrapper" data-v-6aa21345><div class="container" data-v-6aa21345><div class="title" data-v-6aa21345><div class="VPNavBarTitle has-sidebar" data-v-6aa21345 data-v-1168a8e4><a class="title" href="/" data-v-1168a8e4><!--[--><!--]--><!--[--><img class="VPImage logo" src="/assets/newnewlogo.png" width="24" height="24" alt data-v-8426fc1a><!--]--><span data-v-1168a8e4>Homalos</span><!--[--><!--]--></a></div></div><div class="content" data-v-6aa21345><div class="content-body" data-v-6aa21345><!--[--><!--]--><div class="VPNavBarSearch search" data-v-6aa21345><!--[--><!----><div id="local-search"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><span class="vp-icon DocSearch-Search-Icon"></span><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"><kbd class="DocSearch-Button-Key"></kbd><kbd class="DocSearch-Button-Key">K</kbd></span></button></div><!--]--></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-6aa21345 data-v-dc692963><span id="main-nav-aria-label" class="visually-hidden" data-v-dc692963> Main Navigation </span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/guide/quick_start" tabindex="0" data-v-dc692963 data-v-e56f3d57><!--[--><span data-v-e56f3d57>快速开始</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/other/about" tabindex="0" data-v-dc692963 data-v-e56f3d57><!--[--><span data-v-e56f3d57>关于</span><!--]--></a><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-6aa21345 data-v-6c893767><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-6c893767 data-v-5337faa4 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-5337faa4></span><span class="vpi-moon moon" data-v-5337faa4></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-6aa21345 data-v-0394ad82 data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com/Homalos/Homalos" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-bd121fe5><span class="vpi-social-github"></span></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-6aa21345 data-v-bb2aa2f0 data-v-cf11d7a2><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-cf11d7a2><span class="vpi-more-horizontal icon" data-v-cf11d7a2></span></button><div class="menu" data-v-cf11d7a2><div class="VPMenu" data-v-cf11d7a2 data-v-b98bc113><!----><!--[--><!--[--><!----><div class="group" data-v-bb2aa2f0><div class="item appearance" data-v-bb2aa2f0><p class="label" data-v-bb2aa2f0>主题</p><div class="appearance-action" data-v-bb2aa2f0><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-bb2aa2f0 data-v-5337faa4 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-5337faa4></span><span class="vpi-moon moon" data-v-5337faa4></span><!--]--></span></span></button></div></div></div><div class="group" data-v-bb2aa2f0><div class="item social-links" data-v-bb2aa2f0><div class="VPSocialLinks social-links-list" data-v-bb2aa2f0 data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com/Homalos/Homalos" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-bd121fe5><span class="vpi-social-github"></span></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--[--><!--[--><div class="VPFlyout VPNolebaseEnhancedReadabilitiesMenu VPNolebaseEnhancedReadabilitiesMenuFlyout" aria-label="阅读增强" role="menuitem" data-v-cf11d7a2><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-cf11d7a2><span class="text" data-v-cf11d7a2><span class="i-icon-park-outline:book-open option-icon" data-v-cf11d7a2></span><!----><span class="vpi-chevron-down text-icon" data-v-cf11d7a2></span></span></button><div class="menu" data-v-cf11d7a2><div class="VPMenu" data-v-cf11d7a2 data-v-b98bc113><!----><!--[--><!--]--></div></div></div><!--]--><!--]--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-6aa21345 data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><div class="divider" data-v-6aa21345><div class="divider-line" data-v-6aa21345></div></div></div><!----></header><div class="VPLocalNav has-sidebar empty" data-v-5d98c3a5 data-v-a6f0e41e><div class="container" data-v-a6f0e41e><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-a6f0e41e><span class="vpi-align-left menu-icon" data-v-a6f0e41e></span><span class="menu-text" data-v-a6f0e41e>菜单</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-a6f0e41e data-v-8a42e2b4><button data-v-8a42e2b4>回到顶部</button><!----></div></div></div><aside class="VPSidebar" data-v-5d98c3a5 data-v-319d5ca6><div class="curtain" data-v-319d5ca6></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-319d5ca6><span class="visually-hidden" id="sidebar-aria-label" data-v-319d5ca6> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="no-transition group" data-v-c40bc020><section class="VPSidebarItem level-0 collapsible collapsed" data-v-c40bc020 data-v-b3fd67f8><div class="item" role="button" tabindex="0" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><h2 class="text" data-v-b3fd67f8>快速开始</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-b3fd67f8><span class="vpi-chevron-right caret-icon" data-v-b3fd67f8></span></div></div><div class="items" data-v-b3fd67f8><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/guide/quick_start" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>目录导航</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/guide/homalos" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>什么是 Homalos</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/guide/install" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>安装</p><!--]--></a><!----></div><!----></div><section class="VPSidebarItem level-1 collapsible" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" role="button" tabindex="0" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><h3 class="text" data-v-b3fd67f8>启动</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-b3fd67f8><span class="vpi-chevron-right caret-icon" data-v-b3fd67f8></span></div></div><div class="items" data-v-b3fd67f8><!--[--><div class="VPSidebarItem level-2 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/guide/start/start_data_center" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>启动数据中心</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/guide/start/start_homalos" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>启动 Homalos</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" role="button" tabindex="0" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><h3 class="text" data-v-b3fd67f8>配置</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-b3fd67f8><span class="vpi-chevron-right caret-icon" data-v-b3fd67f8></span></div></div><div class="items" data-v-b3fd67f8><!--[--><div class="VPSidebarItem level-2 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/guide/config/system_config" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>系统全局配置</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/guide/config/log_config" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>日志全局配置</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/guide/config/data_center_config" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>数据中心配置</p><!--]--></a><!----></div><!----></div><!--]--></div></section><!--]--></div></section></div><div class="no-transition group" data-v-c40bc020><section class="VPSidebarItem level-0 collapsible collapsed has-active" data-v-c40bc020 data-v-b3fd67f8><div class="item" role="button" tabindex="0" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><h2 class="text" data-v-b3fd67f8>核心架构</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-b3fd67f8><span class="vpi-chevron-right caret-icon" data-v-b3fd67f8></span></div></div><div class="items" data-v-b3fd67f8><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/core/core" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>核心架构概述</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/core/event_driven_system" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>事件驱动系统</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/core/trading_engine" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>交易引擎</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/core/objects_and_service_registry" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>核心对象和服务注册表</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="no-transition group" data-v-c40bc020><section class="VPSidebarItem level-0 collapsible collapsed" data-v-c40bc020 data-v-b3fd67f8><div class="item" role="button" tabindex="0" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><h2 class="text" data-v-b3fd67f8>网关和外部连接</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-b3fd67f8><span class="vpi-chevron-right caret-icon" data-v-b3fd67f8></span></div></div><div class="items" data-v-b3fd67f8><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/gateway/gateway" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>网关和外部连接概述</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/gateway/ctp_gateway" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>CTP网关</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/gateway/tts_gateway" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>TTS网关</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="no-transition group" data-v-c40bc020><section class="VPSidebarItem level-0 collapsible collapsed" data-v-c40bc020 data-v-b3fd67f8><div class="item" role="button" tabindex="0" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><h2 class="text" data-v-b3fd67f8>数据中心</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-b3fd67f8><span class="vpi-chevron-right caret-icon" data-v-b3fd67f8></span></div></div><div class="items" data-v-b3fd67f8><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/datacenter/datacenter" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>数据中心概述</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="no-transition group" data-v-c40bc020><section class="VPSidebarItem level-0 collapsible collapsed" data-v-c40bc020 data-v-b3fd67f8><div class="item" role="button" tabindex="0" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><h2 class="text" data-v-b3fd67f8>数据服务</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-b3fd67f8><span class="vpi-chevron-right caret-icon" data-v-b3fd67f8></span></div></div><div class="items" data-v-b3fd67f8><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/dataservice/dataservice" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>数据服务概述</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="no-transition group" data-v-c40bc020><section class="VPSidebarItem level-0 collapsible collapsed" data-v-c40bc020 data-v-b3fd67f8><div class="item" role="button" tabindex="0" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><h2 class="text" data-v-b3fd67f8>系统面板</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-b3fd67f8><span class="vpi-chevron-right caret-icon" data-v-b3fd67f8></span></div></div><div class="items" data-v-b3fd67f8><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/dashboard/api" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>请求接口</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="no-transition group" data-v-c40bc020><section class="VPSidebarItem level-0 collapsible collapsed" data-v-c40bc020 data-v-b3fd67f8><div class="item" role="button" tabindex="0" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><h2 class="text" data-v-b3fd67f8>其它</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-b3fd67f8><span class="vpi-chevron-right caret-icon" data-v-b3fd67f8></span></div></div><div class="items" data-v-b3fd67f8><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/other/community" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>社区资源</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/other/author" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>作者</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b3fd67f8 data-v-b3fd67f8><div class="item" data-v-b3fd67f8><div class="indicator" data-v-b3fd67f8></div><a class="VPLink link link" href="/other/about" data-v-b3fd67f8><!--[--><p class="text" data-v-b3fd67f8>联系</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-5d98c3a5 data-v-1428d186><div class="VPDoc has-sidebar has-aside" data-v-1428d186 data-v-39a288b8><!--[--><!--]--><div class="container" data-v-39a288b8><div class="aside" data-v-39a288b8><div class="aside-curtain" data-v-39a288b8></div><div class="aside-container" data-v-39a288b8><div class="aside-content" data-v-39a288b8><div class="VPDocAside" data-v-39a288b8 data-v-3f215769><!--[--><!--]--><!--[--><!--]--><nav aria-labelledby="doc-outline-aria-label" class="VPDocAsideOutline" data-v-3f215769 data-v-a5bbad30><div class="content" data-v-a5bbad30><div class="outline-marker" data-v-a5bbad30></div><div aria-level="2" class="outline-title" id="doc-outline-aria-label" role="heading" data-v-a5bbad30>页面导航</div><ul class="VPDocOutlineItem root" data-v-a5bbad30 data-v-b933a997><!--[--><!--]--></ul></div></nav><!--[--><!--]--><div class="spacer" data-v-3f215769></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-39a288b8><div class="content-container" data-v-39a288b8><!--[--><!--]--><main class="main" data-v-39a288b8><div style="position:relative;" class="vp-doc _core_objects_and_service_registry" data-v-39a288b8><div><h1 id="核心对象和服务注册表" tabindex="-1">核心对象和服务注册表 <a class="header-anchor" href="#核心对象和服务注册表" aria-label="Permalink to &quot;核心对象和服务注册表&quot;">​</a></h1><div my-4 class="vp-nolebase-page-properties vp-nolebase-page-properties-container"><div class="vp-nolebase-page-properties-grid grid grid-cols-[180px_auto] gap-1 &lt;sm:grid-cols-[120px_auto]"><!--[--><!--[--><div transition="all ease-in-out" flex items-start text="zinc-400 dark:zinc-500 sm &lt;sm:xs" duration-250><div transition="all ease-in-out" min-h="8 &lt;sm:7" px="2 &lt;sm:1" py="2 &lt;sm:1" w-full flex cursor-pointer items-center bg="hover:zinc-100 dark:hover:zinc-800" rounded-md duration-250><div i-icon-park-outline:add-text mr-1></div><span overflow-hidden text-ellipsis whitespace-nowrap>字数</span></div></div><div cursor-pointer transition="all ease-in-out" min-h="8 &lt;sm:7" px="2 &lt;sm:1" py="1.5 &lt;sm:1" flex="~ row wrap" items-center gap-1 rounded-md text="sm &lt;sm:xs" bg="hover:zinc-100 dark:hover:zinc-800" duration-250><div class="vp-nolebase-page-property" data-page-property="value" data-page-property-type="dynamic" data-page-property-dynamic-type="word-count" w-full inline-flex items-center><span>1195 字</span></div></div><!--]--><!--[--><div transition="all ease-in-out" flex items-start text="zinc-400 dark:zinc-500 sm &lt;sm:xs" duration-250><div transition="all ease-in-out" min-h="8 &lt;sm:7" px="2 &lt;sm:1" py="2 &lt;sm:1" w-full flex cursor-pointer items-center bg="hover:zinc-100 dark:hover:zinc-800" rounded-md duration-250><div i-icon-park-outline:timer mr-1></div><span overflow-hidden text-ellipsis whitespace-nowrap>阅读时间</span></div></div><div cursor-pointer transition="all ease-in-out" min-h="8 &lt;sm:7" px="2 &lt;sm:1" py="1.5 &lt;sm:1" flex="~ row wrap" items-center gap-1 rounded-md text="sm &lt;sm:xs" bg="hover:zinc-100 dark:hover:zinc-800" duration-250><div class="vp-nolebase-page-property" data-page-property="value" data-page-property-type="dynamic" data-page-property-dynamic-type="reading-time" w-full inline-flex items-center><span>5 分钟</span></div></div><!--]--><!--]--></div></div><p>本文档涵盖构成 Homalos 交易系统主干的基本数据结构和服务发现机制。核心对象定义了市场数据、订单、交易和仓位的主要数据模型，而服务注册表则提供了集中式服务发现和健康监控功能。</p><p>EventBus 通讯系统请参见<a class="VPNolebaseInlinePreviewLink" relative href="./event_driven_system" data-v-7fde401a><!--[-->事件驱动系统<!--]--><!----></a>，TradingEngine 编排请参见<a class="VPNolebaseInlinePreviewLink" relative href="./trading_engine" data-v-7fde401a><!--[-->交易引擎<!--]--><!----></a>。</p><h2 id="核心数据对象" tabindex="-1">核心数据对象 <a class="header-anchor" href="#核心数据对象" aria-label="Permalink to &quot;核心数据对象&quot;">​</a></h2><p>Homalos 系统使用一套全面的数据类来表示交易实体。所有核心对象都继承自<code>BaseData</code>并遵循一致的模式，包括网关属性和合约规范化。</p><h3 id="基础数据结构" tabindex="-1">基础数据结构 <a class="header-anchor" href="#基础数据结构" aria-label="Permalink to &quot;基础数据结构&quot;">​</a></h3><p>该类<code>BaseData</code>作为所有交易对象的基础，提供网关归属和可扩展性：</p><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@dataclass</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> BaseData</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">    gateway_name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">    extra: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">dict</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> |</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> None</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> field(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">default</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">init</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">False</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div><p>所有数据对象都会自动生成<code>ho_symbol</code>格式规范化的符号标识符（），<code>{symbol}.{exchange.value}</code>以确保整个系统的识别一致性。</p><h3 id="市场数据对象" tabindex="-1">市场数据对象 <a class="header-anchor" href="#市场数据对象" aria-label="Permalink to &quot;市场数据对象&quot;">​</a></h3><h4 id="tickdata-结构" tabindex="-1">TickData 结构 <a class="header-anchor" href="#tickdata-结构" aria-label="Permalink to &quot;TickData 结构&quot;">​</a></h4><p>该类<code>TickData</code>提供全面的市场数据，包括五级订单簿、每日统计数据和限价。它支持交易所时间戳和本地时间戳，以便进行延迟分析。</p><h4 id="bardata-结构" tabindex="-1">BarData 结构 <a class="header-anchor" href="#bardata-结构" aria-label="Permalink to &quot;BarData 结构&quot;">​</a></h4><p><code>BarData</code>表示特定交易间隔的K线数据，包含 OHLCV 信息以及交易额和未平仓合约数据。</p><h3 id="交易对象" tabindex="-1">交易对象 <a class="header-anchor" href="#交易对象" aria-label="Permalink to &quot;交易对象&quot;">​</a></h3><h4 id="订单管理对象" tabindex="-1">订单管理对象 <a class="header-anchor" href="#订单管理对象" aria-label="Permalink to &quot;订单管理对象&quot;">​</a></h4><p>订单管理系统使用三个主要对象：</p><ul><li><code>OrderRequest</code>用于订单创建请求</li><li><code>OrderData</code>用于跟踪订单状态</li><li><code>TradeData</code>用于记录交易执行情况</li></ul><p>该类<code>OrderData</code>包括<code>is_active()</code>检查订单状态<code>ACTIVE_STATUSES</code>和<code>create_cancel_request()</code>取消订单的方法。</p><h4 id="头寸和账户对象" tabindex="-1">头寸和账户对象 <a class="header-anchor" href="#头寸和账户对象" aria-label="Permalink to &quot;头寸和账户对象&quot;">​</a></h4><p>头寸和账户数据提供实时投资组合跟踪，自动计算可用余额和规范化标识符。</p><h3 id="合约和数据对象" tabindex="-1">合约和数据对象 <a class="header-anchor" href="#合约和数据对象" aria-label="Permalink to &quot;合约和数据对象&quot;">​</a></h3><p>该系统包括<code>ContractData</code>用于工具规范、<code>QuoteData</code>用于报价管理以及用于市场数据操作的各种请求对象（ <code>SubscribeRequest</code>、<code>HistoryRequest</code>、<code>QuoteRequest</code>）</p><h2 id="服务注册系统" tabindex="-1">服务注册系统 <a class="header-anchor" href="#服务注册系统" aria-label="Permalink to &quot;服务注册系统&quot;">​</a></h2><p>该类<code>ServiceRegistry</code>为所有系统组件提供集中式服务发现和健康监控。它以事件驱动的服务形式运行，管理服务注册、心跳监控和服务发现请求。</p><h3 id="服务生命周期管理" tabindex="-1">服务生命周期管理 <a class="header-anchor" href="#服务生命周期管理" aria-label="Permalink to &quot;服务生命周期管理&quot;">​</a></h3><p>服务注册表处理四种主要事件类型：</p><table tabindex="0"><thead><tr><th>事件类型</th><th>处理程序</th><th>描述</th></tr></thead><tbody><tr><td><code>SERVICE_REGISTER</code></td><td><code>handle_register()</code></td><td>注册新服务并广播<code>SERVICE_UPDATED</code></td></tr><tr><td><code>SERVICE_UNREGISTER</code></td><td><code>handle_unregister()</code></td><td>删除服务和广播<code>SERVICE_UPDATED</code></td></tr><tr><td><code>SERVICE_HEART_BEAT</code></td><td><code>handle_heartbeat()</code></td><td>更新服务心跳时间戳</td></tr><tr><td><code>SERVICE_DISCOVERY</code></td><td><code>handle_discovery_request()</code></td><td>使用经过过滤的服务信息进行响应</td></tr></tbody></table><p>发现系统支持基于模式的过滤，并返回不包含敏感数据的经过清理的服务信息。</p><h3 id="心跳监控" tabindex="-1">心跳监控 <a class="header-anchor" href="#心跳监控" aria-label="Permalink to &quot;心跳监控&quot;">​</a></h3><p>注册表运行一个后台线程来监视服务健康状况：</p><ol><li><strong>心跳超时</strong>：10秒</li><li><strong>检查间隔</strong>：5秒</li><li><strong>自动清理</strong>：超过超时的服务将自动取消注册</li><li><strong>失败事件</strong>：<code>SERVICE_FAILED</code>针对超时场景发布事件</li></ol><h2 id="事件驱动集成" tabindex="-1">事件驱动集成 <a class="header-anchor" href="#事件驱动集成" aria-label="Permalink to &quot;事件驱动集成&quot;">​</a></h2><p>核心对象和服务注册表通过标准化的事件类型和数据结构与事件系统无缝集成。</p><h3 id="核心对象的事件类型" tabindex="-1">核心对象的事件类型 <a class="header-anchor" href="#核心对象的事件类型" aria-label="Permalink to &quot;核心对象的事件类型&quot;">​</a></h3><p>事件系统为每个核心对象类别定义了特定的事件类型：</p><table tabindex="0"><thead><tr><th>对象类别</th><th>事件类型</th></tr></thead><tbody><tr><td><strong>市场数据</strong></td><td><code>TICK_UPDATED</code>，<code>MARKET_TICK</code>, <code>MARKET_BAR</code></td></tr><tr><td><strong>订单</strong></td><td><code>ORDER_UPDATED</code>，<code>ORDER_SUBMITTED</code>, <code>ORDER_CANCELLED</code>, <code>ORDER_FILLED</code></td></tr><tr><td><strong>交易</strong></td><td><code>TRADE_UPDATED</code>，<code>TRADE</code></td></tr><tr><td><strong>职位</strong></td><td><code>POSITION_UPDATED</code></td></tr><tr><td><strong>账户</strong></td><td><code>ACCOUNT_UPDATED</code></td></tr><tr><td><strong>合同</strong></td><td><code>CONTRACT_UPDATED</code></td></tr></tbody></table><h2 id="数据流和组件关系" tabindex="-1">数据流和组件关系 <a class="header-anchor" href="#数据流和组件关系" aria-label="Permalink to &quot;数据流和组件关系&quot;">​</a></h2><h3 id="线程安全和回调处理" tabindex="-1">线程安全和回调处理 <a class="header-anchor" href="#线程安全和回调处理" aria-label="Permalink to &quot;线程安全和回调处理&quot;">​</a></h3><p>该类<code>BaseGateway</code>通过辅助类实现线程安全回调处理<code>ThreadSafeCallback</code>，确保正确的事件循环集成：</p><ul><li><strong>事件循环集成</strong>：用于<code>asyncio.run_coroutine_threadsafe()</code>异步任务调度</li><li><strong>重试逻辑</strong>：使用指数退避实现自动重试</li><li><strong>统计跟踪</strong>：监控性能分析的成功/失败率</li><li><strong>资源管理</strong>：适当清理线程池和事件循环</li></ul><h2 id="配置集成" tabindex="-1">配置集成 <a class="header-anchor" href="#配置集成" aria-label="Permalink to &quot;配置集成&quot;">​</a></h2><p>服务注册表和核心对象通过<code>system.yaml</code>文件与系统配置集成，该文件定义：</p><ul><li><strong>事件总线配置</strong>：队列大小、计时器间隔、监控设置</li><li><strong>数据库配置</strong>：连接池、批处理、WAL 模式</li><li><strong>网关配置</strong>：连接参数、超时、重试设置</li><li><strong>服务管理</strong>：健康检查间隔、超时值、自动恢复设置</li></ul><!--[--><!----><div class="bg-$vp-custom-block-details-bg mt-6 vp-nolebase-git-changelog vp-nolebase-git-changelog-history vp-nolebase-git-changelog-history-list vp-nolebase-git-changelog-history-container" rounded-lg p-4 data-v-9cc63e9c><label cursor-pointer data-v-9cc63e9c><div class="vp-nolebase-git-changelog-title flex select-none items-center justify-between" transition="color ease-in-out" text="&lt;sm:xs" duration-200 data-v-9cc63e9c><span class="vp-nolebase-git-changelog-last-edited-title inline-flex items-center gap-3" data-v-9cc63e9c><div class="i-octicon:history-16" data-v-9cc63e9c></div><span data-v-9cc63e9c>最后编辑于 13 天前</span></span><div class="i-octicon:sort-desc-16" ml-auto mr-4 cursor-pointer data-v-9cc63e9c></div><span class="vp-nolebase-git-changelog-view-full-history-title inline-flex cursor-pointer items-center gap-3" data-v-9cc63e9c><span class="&lt;sm:hidden" data-v-9cc63e9c>查看完整历史</span><svg class="rotate-0 i-octicon:chevron-down-16" transition="transform ease-in-out" duration-200 data-v-9cc63e9c></svg></span></div></label><div style="display:none;" class="grid grid-cols-[30px_auto] mt-3 gap-1.5 children:my-auto -ml-1.5" text="&lt;sm:xs" data-v-9cc63e9c><!--[--><!--[--><!--[--><div class="i-octicon:git-commit-16 m-auto rotate-90 transform op-30" data-v-0e4a2b5f></div><div flex gap-1 align-baseline data-v-0e4a2b5f><a href="https://github.com/Homalos/HomalosDocs/commit/4384d966ea490bb4a72873dc5ec825566566b7a9" target="_blank" class="no-icon" data-v-0e4a2b5f><code class="text-xs text-$vp-c-brand-1 hover:text-$vp-c-brand-1" transition="color ease-in-out" duration-200 data-v-0e4a2b5f>4384d96</code></a><span data-v-0e4a2b5f>-</span><span data-v-0e4a2b5f><span class="text-sm &lt;sm:text-xs" data-v-0e4a2b5f>Update zh.ts、footerDta.ts and markdown files</span><span class="my-1 ml-3 gap-1" data-v-0e4a2b5f><!--[--><!--[--><img src="https://gravatar.com/avatar/b8d5677fa18909432d3b381a59fa6cbe31323f9c976d2c30c3d3c57032d01194?d=retro" alt="The avatar of contributor named as Donny" class="vp-nolebase-git-changelog-commit-avatar inline-block h-6 w-6 rounded-full v-middle" data-v-0e4a2b5f><!--]--><!--]--></span><!----></span></div><!--]--><!--]--><!--[--><!--[--><div class="i-octicon:git-commit-16 m-auto rotate-90 transform op-30" data-v-0e4a2b5f></div><div flex gap-1 align-baseline data-v-0e4a2b5f><a href="https://github.com/Homalos/HomalosDocs/commit/e3ee45802d234a11cded59e6ae8d2246549ae7f3" target="_blank" class="no-icon" data-v-0e4a2b5f><code class="text-xs text-$vp-c-brand-1 hover:text-$vp-c-brand-1" transition="color ease-in-out" duration-200 data-v-0e4a2b5f>e3ee458</code></a><span data-v-0e4a2b5f>-</span><span data-v-0e4a2b5f><span class="text-sm &lt;sm:text-xs" data-v-0e4a2b5f>Update gateway</span><span class="my-1 ml-3 gap-1" data-v-0e4a2b5f><!--[--><!--[--><img src="https://gravatar.com/avatar/b8d5677fa18909432d3b381a59fa6cbe31323f9c976d2c30c3d3c57032d01194?d=retro" alt="The avatar of contributor named as Donny" class="vp-nolebase-git-changelog-commit-avatar inline-block h-6 w-6 rounded-full v-middle" data-v-0e4a2b5f><!--]--><!--]--></span><!----></span></div><!--]--><!--]--><!--]--></div></div><!--]--></div></div></main><footer class="VPDocFooter" data-v-39a288b8 data-v-e257564d><!--[--><!--]--><div class="edit-info" data-v-e257564d><div class="edit-link" data-v-e257564d><a class="VPLink link vp-external-link-icon no-icon edit-link-button" href="https://github.com/Homalos/HomalosDocs/edit/main/src/core/objects_and_service_registry.md" target="_blank" rel="noreferrer" data-v-e257564d><!--[--><span class="vpi-square-pen edit-link-icon" data-v-e257564d></span> 在 GitHub 上编辑此页面<!--]--></a></div><div class="last-updated" data-v-e257564d><p class="VPLastUpdated" data-v-e257564d data-v-e98dd255>最后更新于: <time datetime="2025-07-18T15:23:16.000Z" data-v-e98dd255></time></p></div></div><nav class="prev-next" aria-labelledby="doc-footer-aria-label" data-v-e257564d><span class="visually-hidden" id="doc-footer-aria-label" data-v-e257564d>Pager</span><div class="pager" data-v-e257564d><a class="VPLink link pager-link prev" href="/core/trading_engine" data-v-e257564d><!--[--><span class="desc" data-v-e257564d>上一页</span><span class="title" data-v-e257564d>交易引擎</span><!--]--></a></div><div class="pager" data-v-e257564d><a class="VPLink link pager-link next" href="/gateway/gateway" data-v-e257564d><!--[--><span class="desc" data-v-e257564d>下一页</span><span class="title" data-v-e257564d>网关和外部连接概述</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!----><!--]--></div></div>
    
    
  </body>
</html>